<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create(
            'users', function (Blueprint $table) {
                $table->id();
                $table->string('name',100)->comment('姓名');
                $table->string('username',100)->unique()->comment('用户名');
                $table->char('phone',12)->unique()->comment('手机号');
                $table->string('email',100)->nullable(true)->unique()->comment('邮箱');
                $table->string('password')->comment('密码');
                $table->unsignedTinyInteger('status')->default(1)->comment('状态 1 正常 2 异常');
                $table->timestamps();
            }
        );
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
